package org.cjlm.util;

import java.security.SecureRandom;

public class MUID {

    private static String CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    public static String[] genID(int num){
        String[] results = new String[num];
        for(int i = 0; i < num; i ++){
            results[i] = genID();
        }
        return results;
    }

    public static String genID(){
        SecureRandom random = new SecureRandom();
        StringBuilder sb = new StringBuilder(20);
        for (int i = 0; i < 20; i++) {
            sb.append(CHARS.charAt(random.nextInt(CHARS.length())));
        }
        return sb.toString();
    }
}
